# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test05
# Description:  例8.5
# Author:       ASUS
# Date:         2019/3/11
#-------------------------------------------------------------------------------


class MyParentClass:
    def method(self):
        return 50
class ParentClass(MyParentClass):
    def method1(self):
        print("method1")
class ChildClass(ParentClass):
    def method2(self):
        print("method2")
class MyClass:
    def method(self):
        return 40

#判断第一个参数的类是否继承第二个参数
print(issubclass(ChildClass,ParentClass))                  #直接继承，返回True
print(issubclass(ChildClass,MyParentClass))                #间接继承也返回True
print(issubclass(ChildClass,MyClass))
# 返回类的直接父类（们）
print(ChildClass.__bases__)
print(ParentClass.__bases__)
# 判断第一个参数的对象是否是第二个参数的实例
child = ChildClass()
print(isinstance(child,ChildClass))                       #True
print(isinstance(child,ParentClass))                      #True
print(isinstance(child,MyParentClass))                    #True
print(isinstance(child,MyClass))